<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SSD1306 OLED display driver: SpritePool Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">SSD1306 OLED display driver
   &#160;<span id="projectnumber">1.8.2</span>
   </div>
   <div id="projectbrief">This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-attribs">Static Public Attributes</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="class_sprite_pool-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">SpritePool Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p><code>#include &lt;<a class="el" href="sprite__pool_8h_source.html">sprite_pool.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ad7f28dde3e55d7e57f68507058c7cbda"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#ad7f28dde3e55d7e57f68507058c7cbda">SpritePool</a> ()</td></tr>
<tr class="separator:ad7f28dde3e55d7e57f68507058c7cbda"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af3736a90cef87f0a61b260e6b196d289"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#af3736a90cef87f0a61b260e6b196d289">drawSprites</a> ()</td></tr>
<tr class="separator:af3736a90cef87f0a61b260e6b196d289"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2dc3ee649258b377b5a6bb7c0e2fdb16"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#a2dc3ee649258b377b5a6bb7c0e2fdb16">refreshScreen</a> ()</td></tr>
<tr class="separator:a2dc3ee649258b377b5a6bb7c0e2fdb16"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a60cdca785f31e9535d97485afb4b2202"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#a60cdca785f31e9535d97485afb4b2202">add</a> (<a class="el" href="struct_s_p_r_i_t_e.html">SPRITE</a> &amp;sprite)</td></tr>
<tr class="separator:a60cdca785f31e9535d97485afb4b2202"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a225cec38d6557f304d2279005a8aa523"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#a225cec38d6557f304d2279005a8aa523">clear</a> ()</td></tr>
<tr class="separator:a225cec38d6557f304d2279005a8aa523"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adce65ce2eaf9c7389e357f6f039ae7d6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#adce65ce2eaf9c7389e357f6f039ae7d6">remove</a> (<a class="el" href="struct_s_p_r_i_t_e.html">SPRITE</a> &amp;sprite)</td></tr>
<tr class="separator:adce65ce2eaf9c7389e357f6f039ae7d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a685c20c2e1b762cf10fad3e89701e0e3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#a685c20c2e1b762cf10fad3e89701e0e3">setRect</a> (<a class="el" href="struct_s_s_d1306___r_e_c_t.html">SSD1306_RECT</a> rect)</td></tr>
<tr class="separator:a685c20c2e1b762cf10fad3e89701e0e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-attribs"></a>
Static Public Attributes</h2></td></tr>
<tr class="memitem:abef7ea5b3414ec7adf053d56df13b7c4"><td class="memItemLeft" align="right" valign="top"><a id="abef7ea5b3414ec7adf053d56df13b7c4"></a>
static const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#abef7ea5b3414ec7adf053d56df13b7c4">SP_ERR_NO_SPACE</a> = 0xFF</td></tr>
<tr class="memdesc:abef7ea5b3414ec7adf053d56df13b7c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">No free space for new sprite error. <br /></td></tr>
<tr class="separator:abef7ea5b3414ec7adf053d56df13b7c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa7522b59d079d63cfbb0612aaaee58df"><td class="memItemLeft" align="right" valign="top"><a id="aa7522b59d079d63cfbb0612aaaee58df"></a>
static const uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#aa7522b59d079d63cfbb0612aaaee58df">MAX_SPRITES</a> = 10</td></tr>
<tr class="memdesc:aa7522b59d079d63cfbb0612aaaee58df"><td class="mdescLeft">&#160;</td><td class="mdescRight">Defines max sprites number supported by <a class="el" href="class_sprite_pool.html">SpritePool</a>. <br /></td></tr>
<tr class="separator:aa7522b59d079d63cfbb0612aaaee58df"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a41028a036ef9e90c6d6e89ff0f8d8db7"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#a41028a036ef9e90c6d6e89ff0f8d8db7">drawBlock</a> (uint8_t blockColumn, uint8_t blockRow)</td></tr>
<tr class="separator:a41028a036ef9e90c6d6e89ff0f8d8db7"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:aacf3c183566ace3d39ace8755a2a60aa"><td class="memItemLeft" align="right" valign="top"><a id="aacf3c183566ace3d39ace8755a2a60aa"></a>
<a class="el" href="class_nano_canvas.html">NanoCanvas</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#aacf3c183566ace3d39ace8755a2a60aa">m_canvas</a></td></tr>
<tr class="memdesc:aacf3c183566ace3d39ace8755a2a60aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Canvas used to draw sprites to avoid flickering. <br /></td></tr>
<tr class="separator:aacf3c183566ace3d39ace8755a2a60aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a3cbbd6bbd5c9c74f1ed5dd8e631589"><td class="memItemLeft" align="right" valign="top"><a id="a4a3cbbd6bbd5c9c74f1ed5dd8e631589"></a>
<a class="el" href="struct_s_s_d1306___r_e_c_t.html">SSD1306_RECT</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_sprite_pool.html#a4a3cbbd6bbd5c9c74f1ed5dd8e631589">m_rect</a></td></tr>
<tr class="memdesc:a4a3cbbd6bbd5c9c74f1ed5dd8e631589"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rectangle, which specifies part of the display, used by the sprites. <br /></td></tr>
<tr class="separator:a4a3cbbd6bbd5c9c74f1ed5dd8e631589"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Sprites pool class automates processing of several sprites. It remembers pointers to <a class="el" href="struct_s_p_r_i_t_e.html">SPRITE</a> objects, and carefully updates only the areas, touched by the sprites. So, it reduces number of i2c calls to SSD1306 display. </p><dl class="section warning"><dt>Warning</dt><dd>this class is deprecated and not supported anymore. </dd></dl>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000022">Deprecated:</a></b></dt><dd>use <a class="el" href="class_nano_engine.html">NanoEngine</a>, <a class="el" href="class_nano_sprite.html">NanoSprite</a> objects. </dd></dl>

<p class="definition">Definition at line <a class="el" href="sprite__pool_8h_source.html#l00042">42</a> of file <a class="el" href="sprite__pool_8h_source.html">sprite_pool.h</a>.</p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ad7f28dde3e55d7e57f68507058c7cbda"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad7f28dde3e55d7e57f68507058c7cbda">&#9670;&nbsp;</a></span>SpritePool()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">SpritePool::SpritePool </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Creates empty <a class="el" href="class_sprite_pool.html">SpritePool</a> object. It is able to hold up to 10 sprites on AVR platforms and up to 32 sprites on ESP platforms. </p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a60cdca785f31e9535d97485afb4b2202"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a60cdca785f31e9535d97485afb4b2202">&#9670;&nbsp;</a></span>add()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t SpritePool::add </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_s_p_r_i_t_e.html">SPRITE</a> &amp;&#160;</td>
          <td class="paramname"><em>sprite</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Adds <a class="el" href="struct_s_p_r_i_t_e.html">SPRITE</a> object to the internal list of <a class="el" href="class_sprite_pool.html">SpritePool</a> </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sprite</td><td>- reference to <a class="el" href="struct_s_p_r_i_t_e.html">SPRITE</a> object </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>index of added object or SP_ERR_NO_SPACE in case of error. </dd></dl>

</div>
</div>
<a id="a225cec38d6557f304d2279005a8aa523"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a225cec38d6557f304d2279005a8aa523">&#9670;&nbsp;</a></span>clear()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void SpritePool::clear </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Removes all <a class="el" href="struct_s_p_r_i_t_e.html">SPRITE</a> objects from internal list of <a class="el" href="class_sprite_pool.html">SpritePool</a>. </p>

</div>
</div>
<a id="a41028a036ef9e90c6d6e89ff0f8d8db7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a41028a036ef9e90c6d6e89ff0f8d8db7">&#9670;&nbsp;</a></span>drawBlock()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void SpritePool::drawBlock </td>
          <td>(</td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>blockColumn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint8_t&#160;</td>
          <td class="paramname"><em>blockRow</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">protected</span><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>This method is call every time 8x8 pixels block is needed to be drawn. Use m_canvas field variable, which represents block to update. For example, you can draw any 8x8 image, starting at 0,0 position in m_canvas.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">blockColumn</td><td>- column of the block to redraw </td></tr>
    <tr><td class="paramname">blockRow</td><td>- row of the block to redraw </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>128x64 display has 16 columns and 8 rows. </dd></dl>

</div>
</div>
<a id="af3736a90cef87f0a61b260e6b196d289"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af3736a90cef87f0a61b260e6b196d289">&#9670;&nbsp;</a></span>drawSprites()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void SpritePool::drawSprites </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Draw all areas, touched by the sprites. To remove flickering, the method uses <a class="el" href="class_nano_canvas.html">NanoCanvas</a> capabilities. </p>

</div>
</div>
<a id="a2dc3ee649258b377b5a6bb7c0e2fdb16"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2dc3ee649258b377b5a6bb7c0e2fdb16">&#9670;&nbsp;</a></span>refreshScreen()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void SpritePool::refreshScreen </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Redraws whole area, used by the sprites. </p>

</div>
</div>
<a id="adce65ce2eaf9c7389e357f6f039ae7d6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adce65ce2eaf9c7389e357f6f039ae7d6">&#9670;&nbsp;</a></span>remove()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void SpritePool::remove </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_s_p_r_i_t_e.html">SPRITE</a> &amp;&#160;</td>
          <td class="paramname"><em>sprite</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Removes specific <a class="el" href="struct_s_p_r_i_t_e.html">SPRITE</a> object from the <a class="el" href="class_sprite_pool.html">SpritePool</a>. </p>

</div>
</div>
<a id="a685c20c2e1b762cf10fad3e89701e0e3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a685c20c2e1b762cf10fad3e89701e0e3">&#9670;&nbsp;</a></span>setRect()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void SpritePool::setRect </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_s_s_d1306___r_e_c_t.html">SSD1306_RECT</a>&#160;</td>
          <td class="paramname"><em>rect</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>Sets active paint area region in blocks (pixels / 8) </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">rect</td><td>- region in blocks (pixels / 8) </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="sprite__pool_8h_source.html#l00096">96</a> of file <a class="el" href="sprite__pool_8h_source.html">sprite_pool.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="sprite__pool_8h_source.html">sprite_pool.h</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>
